#ifndef COMMON_H
#define COMMON_H

#include <QString>
#include <QMap>
#include <QDateTime>
#include <QVector>
#include <QMap>
#include <QDebug>

enum OperationType
{
    OP_UNKNOWN,
    OP_OPEN,
    OP_CLOSE_WRITE,
    OP_CLOSE_NOWRITE,
    OP_CREATE,
    OP_DELETE,
    OP_DELETE_SELF,
    OP_MOVE_TO,
    OP_MOVE_FROM,
    OP_MOVE_SELF,
    OP_ACCESS,
    OP_MODIFY,
    OP_ATTRIB,
};

class OperationNode
{
public:
    QString m_fileName;
    QString m_operator;
    OperationType m_operationType;
    QDateTime m_date;

    bool operator==(const OperationNode &b) {
        return ((this->m_date == b.m_date) && (this->m_fileName == b.m_fileName)
                && (this->m_operator == b.m_operator) && (this->m_operationType == b.m_operationType));
    }
    void clear() {
        m_fileName.clear();
        m_operator.clear();
    }
};

class ReportNode
{
public:
    QString m_fileName;
    QString m_date;
    QString m_uDiskDir;
    QString m_operation;

    bool operator==(const ReportNode &b) {
        return ((this->m_date == b.m_date) && (this->m_fileName == b.m_fileName)
                && (this->m_operation == b.m_operation) && (this->m_uDiskDir == b.m_uDiskDir));
    }
};

bool saveLocal(const ReportNode &node);
QList<ReportNode> readLock();

#endif // COMMON_H
